import Taro, { Current } from '@tarojs/taro'
import React, { PureComponent } from 'react'
// 界面组件
import { View, Text } from '@tarojs/components'

import CTopbar from '../../../components/CTopBar/index'
import { get_my_team_api } from './service'
import GetTopBarInfo from '@/utils/GetTopBarInfo' //动态高度
import './index.scss'

/**
 * 我的团队
 */
class MyTeam extends PureComponent<any> {
  constructor(props) {
    super(props)
    this.state = { team_number: 0 }
  }

  componentDidMount() {
    this.get_my_team()
  }

  async get_my_team() {
    await get_my_team_api().then(({ result, data }) => {
      this.setState({
        team_number: data,
      })
    })
  }

  render() {
    const { team_number } = this.state
    return (
      <View style={{ paddingTop: `${GetTopBarInfo().TopBarHeight}px` }}>
        <View className='header'>
          <CTopbar title='我的团队' showBack></CTopbar>
        </View>
        <View className='main'>
          <Text className='main_title'>团队人数</Text>
          <Text className='team_number'>{team_number}（人）</Text>
        </View>
      </View>
    )
  }
}

export default MyTeam
